import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Manage',
    component: () => import('../views/Manage.vue'),
    redirect: "/home",
    //子路由
    children: [
      {path: 'home', name: 'Home', meta: {title: '首页'}, component: () => import('../views/Home.vue')},
      {path: 'user', name: 'User', meta: {title: '用户管理'},  component: () => import('../views/User.vue')},
      {path: 'person', name: 'Person', meta: {title: '个人信息'},  component: () => import('../views/Person.vue')},
      {path: 'file', name: 'File', meta: {title: '文件管理'},  component: () => import('../views/File.vue')},
    ]
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
